package com.chen.springsecurity.controller;

import com.chen.springsecurity.domain.ResponseResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName HelloController.java
 * @Description TODO
 * @createTime 2023年08月28日 10:17:00
 */
@RestController
public class HelloController {

    @GetMapping("/hello")
//    @PreAuthorize("hasAuthority('system:dept:list')")
    @PreAuthorize("@ex.hasAuthority('system:dept:list')")
    public String hello() {
        return "hello spring security";
    }

    @PostMapping("/testCors")
    public ResponseResult testCors() {
        return new ResponseResult(200, "testCors");
    }
}
